<template>
	<view class="">
		<view class="m-5 p-5 bg-white rounded shadow" v-for="(i, index) in list" :key="index">
			<ys-title :title="i.meta.title"></ys-title>
			<view class="grid gap-4 grid-cols-3 mt-2">
				<view class="" v-for="(j, index2) in i.children" :key="index2">
					<u-button type="primary" :plain="true" :text="j.meta.title" size="mini" @click="toMenu(j.meta.title)"></u-button>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import request from '@/utils/request.js'
	import {toast, route} from '@/utils/utils.js'
	export default {
		data() {
			return {
				list: null
			}
		},
		onLoad() {
			this.getRouters()
		},
		methods: {
			toMenu(title) {
				if (title === '我的配货单' ) {
					route('/pages/order/choose', {
						type: 0
					})
				} else if (title === '我的要货单') {
					route('/pages/order/choose', {
						type: 1
					})
				} else if (title === '库存盘点') {
					route('/pages/order/choose', {
						type: 2
					})
				}
				else if (title === '采购单管理') {
					route('/pages/purchase/list')
				}
			},
			getRouters() {
				request('getRouters').then(res => {
					this.list = res
				})
			}
		}
	}
</script>

<style>

</style>
